package com.china08.yxyapi.repository.db.yxy;

import java.util.Date;
import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.china08.yxyapi.entity.db.yxy.YxyHoliday;

public interface YxyHolidayRepository extends JpaRepository<YxyHoliday, Integer> {

    List<YxyHoliday> findByYear(Integer year);

    YxyHoliday findByYearAndDay(int year, Date date);

    @Modifying
    @Transactional
    void deleteByYearAndDay(int year, Date day);

    /** 查询每周假期 **/
    @Query(value = "SELECT * FROM yxy_yxy.yxy_yxy_holiday WHERE DAY = ?", nativeQuery = true)
    YxyHoliday findByDay(String thisWeekDate);

}
